<?php
	echo $this -> Html -> script(array('maccount.js'));
?>
<div id="mainContent">
<?php
	echo $this -> Form -> create('Account', array('id' => 'frmMain', 'url' => 'update', 'data-ajax' => 'false'));
?>
    <!--  start content-table-inner -->
	<div id="content-table-inner">
        <p>
        	<input type="button" value="Thêm người quản lí mới" onclick="location.href='<?php echo $this -> Html -> url('/',true); ?>maccount/insert'" />
        </p>
        <br />
        <table id="product-table" border="0" width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <th><a>Họ</a></th>
                <th><a>Tên</a></th>
                <th><a>Tên đăng nhập</a></th>
                <th><a>Email</a></th>
                <th><a>Quyền hạn</a></th>
                <th><a>Trạng thái</a></th>
                <th>&nbsp</th>
            </tr>
            <?php 
	            foreach ($accountList as $account) {
	                echo "<tr>";
	                    echo "<td>".$account['Account']['firstname']."</td>";
	                    echo "<td>".$account['Account']['lastname']."</td>";
	                    echo "<td>".$account['Account']['username']."</td>";
	                    echo "<td>".$account['Account']['email']."</td>";
	            		if($account['Account']['role'] == '1') {
	                    	echo "<td>Quản lí cấp cao</td>";
	                    } else {
	                    	echo "<td>Quản lí cấp thấp</td>";
	                    }
	                    if($account['Account']['status'] == '1') {
	                    	echo "<td>Bật</td>";
	                    } else {
	                    	echo "<td>Tắt</td>";
	                    }
	                    echo "<td>";
	                        echo "<input type='button' value='Sửa' onclick='Update(".$account['Account']['id'].")' />";
	                        echo " <input type='button' value='Xóa' onclick='Delete(".$account['Account']['id'].")' />";
	                    echo "</td>";
                	echo "</tr>";
            	}
            ?>
        </table>
    </div>
<?php echo $this -> Form -> end(); ?>
</div>